using NUnit.Framework;

namespace Solver
{
	/// <summary>
	/// Find the sum of all numbers less than one million, which are palindromic in base 10 and base 2.
	/// </summary>
	public class Problem036 : SelfChecker, IProblem
	{
		public int Id
		{
			get { return 36; }
		}

		public string Solve()
		{
			var s = 0;
			for (var n = 1; n < 1000000; n += 2)
				if (Palindrome.IsPalindrome2(n) && Palindrome.IsPalindrome10(n))
					s += n;
			return s.ToString();
		}

		[Test]
		public override void Check()
		{
			Assert.AreEqual("872187", Solve());
		}
	}
}